/EDUC-8 Minimum Octal Read and Write Program by Steven S. Pietrobon 25 Apr 2009
/
/This program allows you to read and write programs using the EDUC-8 Keypad
/and Octal Display. Set the Octal Display to 737. All program data is entered
/in 737 format, from left to right. The Keypad is connected to ID0 and the
/Octal Display to OD0.
/
/After entering this program, enter the address index (IDX) of the program to 
/be written at address 000. Then enter the start address of this program 030
/and run the program. The IDX will be displayed in AC and the contents at
/address IDX are displayed in the octal display. To read the contents of the 
/next location, press Enter on the keypad.
/
/To change the contents, enter the three digit code using the keypad. At the 
/end of writing the code, the updated code will be displayed on the octal 
/display. If you have made a mistake, re-enter the three digit code. If not, 
/press ENTER on the keypad. This will increment IDX and display the contents of 
/the next code.
/
/In this way you can first write a program. Then halting the program and 
/re-initialising IDX, the program can be checked. If an incorrect entry is 
/found, the correct code can be entered for that location.
/
/If you get out of step, halt the program, re-enter the new IDX, and then 
/restart the program. The program uses a total of 29 words in two pages.
/
/25 Apr 2009 Use AC to display IDX
/ 4 Jan 2009 First release.

/IDX,        VAR=#035         /Program Index

IDX,        VAR=#000         /Program Index

/14
INPUT,      RTNADR
            RAL
            RAL
            DCA I IDX        /P[IDX] := 4*AC
            TAD IDX          /AC := IDX
TESTCHAR1,  SKF 0            /if CHARFLAG = 0
            JMP TESTCHAR1    /then TESTCHAR1 else
            KRB 0            /read(AC), FLAG := 0
            TAD I IDX        /AC := AC+P[IDX]
            JMP I INPUT

NEXTCHAR,   JMS INPUT        /Read second number
            RAL              /AC := 2*AC
            JMS INPUT        /Read third number
            DCA I IDX        /P[IDX] := AC
WRITECHAR,  TAD I IDX        /AC := P[IDX]
/15
            LDS 0            /write(AC)
            TAD IDX          /AC := IDX
TESTCHAR2,  SKF 0            /if CHARFLAG = 0
            JMP TESTCHAR2    /then TESTCHAR2 else
            KRB 0            /read(AC), FLAG := 0
            SMA              /if AC >= 0
            JMP NEXTCHAR     /then NEXTCHAR else
            INC IDX          /IDX := IDX+1
START,      CLA
            JMP WRITECHAR
